

class GoogleDirectionsM {
  GoogleDirectionsM({
      this.routes,
      this.status,});

  GoogleDirectionsM.fromJson(dynamic json) {

    if (json['routes'] != null) {
      routes = [];
      json['routes'].forEach((v) {
        routes!.add(Routes.fromJson(v));
      });
    }
    status = json['status'];
  }
  List<Routes>? routes;
  String? status;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};

    if (routes != null) {
      map['routes'] = routes!.map((v) => v.toJson()).toList();
    }
    map['status'] = status;
    return map;
  }

}
class Legs {
  Legs({
    this.distance,
    this.duration,
    this.endAddress,
    this.endLocation,
    this.startAddress,
    this.startLocation,
    this.steps,});

  Legs.fromJson(dynamic json) {
    distance = json['distance'] != null ? Distance.fromJson(json['distance']) : null;
    duration = json['duration'] != null ? BDuration.fromJson(json['duration']) : null;
    endAddress = json['end_address'];
    endLocation = json['end_location'] != null ? EndLocation.fromJson(json['end_location']) : null;
    startAddress = json['start_address'];
    startLocation = json['start_location'] != null ? EndLocation.fromJson(json['start_location']) : null;
    if (json['steps'] != null) {
      steps = [];
      json['steps'].forEach((v) {
        steps!.add(Steps.fromJson(v));
      });
    }
  }
  Distance? distance;
  BDuration? duration;
  String? endAddress;
  EndLocation? endLocation;
  String? startAddress;
  EndLocation? startLocation;
  List<Steps>? steps;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    if (distance != null) {
      map['distance'] = distance!.toJson();
    }
    if (duration != null) {
      map['duration'] = duration!.toJson();
    }
    map['end_address'] = endAddress;
    if (endLocation != null) {
      map['end_location'] = endLocation!.toJson();
    }
    map['start_address'] = startAddress;
    if (startLocation != null) {
      map['start_location'] = startLocation!.toJson();
    }
    if (steps != null) {
      map['steps'] = steps!.map((v) => v.toJson()).toList();
    }
    return map;
  }

}


class Steps {
  Steps({
    this.distance,
    this.duration,
    this.endLocation,
    this.htmlInstructions,
    this.polyline,
    this.startLocation,
    this.travelMode,});

  Steps.fromJson(dynamic json) {
    distance = json['distance'] != null ? Distance.fromJson(json['distance']) : null;
    duration = json['duration'] != null ? BDuration.fromJson(json['duration']) : null;
    endLocation = json['end_location'] != null ? EndLocation.fromJson(json['end_location']) : null;
    htmlInstructions = json['html_instructions'];
    polyline = json['polyline'] != null ? Polyline.fromJson(json['polyline']) : null;
    startLocation = json['start_location'] != null ? EndLocation.fromJson(json['start_location']) : null;
    travelMode = json['travel_mode'];
  }
  Distance? distance;
  BDuration? duration;
  EndLocation? endLocation;
  String? htmlInstructions;
  Polyline? polyline;
  EndLocation? startLocation;
  String? travelMode;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    if (distance != null) {
      map['distance'] = distance!.toJson();
    }
    if (duration != null) {
      map['duration'] = duration!.toJson();
    }
    if (endLocation != null) {
      map['end_location'] = endLocation!.toJson();
    }
    map['html_instructions'] = htmlInstructions;
    if (polyline != null) {
      map['polyline'] = polyline!.toJson();
    }
    if (startLocation != null) {
      map['start_location'] = startLocation!.toJson();
    }
    map['travel_mode'] = travelMode;
    return map;
  }

}


class Routes {
  Routes({
    this.bounds,
    this.copyrights,
    this.legs,
    this.overviewPolyline,
    this.summary,});

  Routes.fromJson(dynamic json) {
    bounds = json['bounds'] != null ? Bounds.fromJson(json['bounds']) : null;
    copyrights = json['copyrights'];
    if (json['legs'] != null) {
      legs = [];
      json['legs'].forEach((v) {
        legs!.add(Legs.fromJson(v));
      });
    }
    overviewPolyline = json['overview_polyline'] != null ? OverviewPolyline.fromJson(json['overview_polyline']) : null;
    summary = json['summary'];
  }
  Bounds? bounds;
  String? copyrights;
  List<Legs>? legs;
  OverviewPolyline? overviewPolyline;
  String? summary;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    if (bounds != null) {
      map['bounds'] = bounds!.toJson();
    }
    map['copyrights'] = copyrights;
    if (legs != null) {
      map['legs'] = legs!.map((v) => v.toJson()).toList();
    }
    if (overviewPolyline != null) {
      map['overview_polyline'] = overviewPolyline!.toJson();
    }
    map['summary'] = summary;
    return map;
  }

}

class Bounds {
  Bounds({
    this.northeast,
    this.southwest,});

  Bounds.fromJson(dynamic json) {
    northeast = json['northeast'] != null ? EndLocation.fromJson(json['northeast']) : null;
    southwest = json['southwest'] != null ? EndLocation.fromJson(json['southwest']) : null;
  }
  EndLocation? northeast;
  EndLocation? southwest;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    if (northeast != null) {
      map['northeast'] = northeast!.toJson();
    }
    if (southwest != null) {
      map['southwest'] = southwest!.toJson();
    }
    return map;
  }

}

class Polyline {
  Polyline({
    this.points,});

  Polyline.fromJson(dynamic json) {
    points = json['points'];
  }
  String? points;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['points'] = points;
    return map;
  }

}


class OverviewPolyline {
  OverviewPolyline({
    this.points,});

  OverviewPolyline.fromJson(dynamic json) {
    points = json['points'];
  }
  String? points;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['points'] = points;
    return map;
  }

}

class EndLocation {
  EndLocation({
    this.lat,
    this.lng,});

  EndLocation.fromJson(dynamic json) {
    lat = json['lat'];
    lng = json['lng'];
  }
  num? lat;
  num? lng;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['lat'] = lat;
    map['lng'] = lng;
    return map;
  }

}

class BDuration {
  BDuration({
    this.text,
    this.value,});

  BDuration.fromJson(dynamic json) {
    text = json['text'];
    value = json['value'];
  }
  String? text;
  num? value;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['text'] = text;
    map['value'] = value;
    return map;
  }

}

class Distance {
  Distance({
    this.text,
    this.value,});

  Distance.fromJson(dynamic json) {
    text = json['text'];
    value = json['value'];
  }
  String? text;
  num? value;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['text'] = text;
    map['value'] = value;
    return map;
  }

}